package com.slwu.singleton;

/**
 * 饿汉式单例
 * 优点：线程安全，在类加载的时候就已经实例化了，不需要加锁
 * 缺点：类加载的时候就已经实例化了，没有达到懒加载的效果
 * @author wushaolin
 * @since 2023-11-22
 */
public class EagerSingleton {
    private static final EagerSingleton eagerSingleton = new EagerSingleton();
    private EagerSingleton() {}

    public static EagerSingleton getInstance() {
        return eagerSingleton;
    }
}
